Skip to content

Marcos_Kata_Sum_Prime_Factors#137

Open
marcos-x86 wants to merge 4 commits intodevelopfrom
marcos_lara_sum_prime_factors
Open

Marcos_Kata_Sum_Prime_Factors#137
marcos-x86 wants to merge 4 commits intodevelopfrom
marcos_lara_sum_prime_factors

Conversation

@marcos-x86
Copy link
Contributor

Sum by Factors

Given an array of positive or negative integers

I= [i1,..,in]

you have to produce a sorted array P of the form

[ [p, sum of all ij of I for which p is a prime factor (p positive) of ij] ...]

P will be sorted by increasing order of the prime numbers. The final result has to be given as a string in Java, C# or C++ and as an array of arrays in other languages.

Example:

I = {12, 15}; // result = "(2 12)(3 27)(5 15)"

[2, 3, 5] is the list of all prime factors of the elements of I, hence the result.

Notes: It can happen that a sum is 0 if some numbers are negative!

Example: I = [15, 30, -45] 5 divides 15, 30 and (-45) so 5 appears in the result, the sum of the numbers for which 5 is a factor is 0 so we have [5, 0] in the result amongst others.

@codecov-io
Copy link

codecov-io commented Sep 4, 2017

Codecov Report

Merging #137 into develop will increase coverage by 0.13%.
The diff coverage is 100%.

Impacted file tree graph

@@              Coverage Diff              @@
##             develop     #137      +/-   ##
=============================================
+ Coverage      87.84%   87.97%   +0.13%     
- Complexity       456      464       +8     
=============================================
  Files            103      104       +1     
  Lines            987      998      +11     
  Branches         161      162       +1     
=============================================
+ Hits             867      878      +11     
  Misses           106      106              
  Partials          14       14
Impacted Files Coverage Δ Complexity Δ
.../org/fundacionjala/coding/marcos/SumOfDivided.java 100% <100%> (ø) 8 <8> (?)

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update ba1f59d...b870404. Read the comment docs.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants